package com.example.designpartten.publish;

import java.util.Vector;

/**
 * @author hql
 * @date 2020/4/8 16:52
 */
public abstract class Subject {

    private Vector<Observer> observers = new Vector<>();

    public void addObserver(Observer o) {
        this.observers.add(o);
    }

    public void deleteObserver(Observer o) {
        this.observers.remove(o);
    }

    public void notifyObserver() {
        for(Observer o : observers) {
                o.update();
        }
    }
}
